

#ifndef _MUTEX_H__INCLUDED_
#define _MUTEX_H__INCLUDED_

#include <memory>

namespace nebula { namespace utility {

class MutexImpl;

class Mutex
{
public:

    /*
        spin will decide the spin count when
    */
    Mutex(int spin = 0);
    ~Mutex();

    void lock();
    void unlock();
    bool try_lock();

    friend class ConditionImpl;

private:
    std::auto_ptr<MutexImpl> pImpl;

private:
    Mutex(Mutex& rhs);
    Mutex& operator= (Mutex& rhs);
};

}} // namespace nebula::utility

#endif
